package cn.com.lei.du.controller;

import cn.com.lei.du.entity.User;
import cn.com.lei.du.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/getUser")
    public User getUser(){
        return userService.getUser();
    }

    @GetMapping("/getUserParam")
    public User getUserParam(String name){
        return userService.getUserParam(name);
    }

    @GetMapping("/getUserHeader")
    public User getUserHeader(String name){
        return userService.getUserHeader(name);
    }

    @GetMapping("/getUserBody")
    public User getUserBody(String name){
        User user = new User();
        user.setName(name);
        return userService.getUserBody(user);
    }

    @GetMapping("/getUserPath")
    public User getUserPath(String name){
        return userService.getUserPath(name);
    }

    @GetMapping("/getUserRetry")
    public User getUserRetry(){
        return userService.getUserRetry();
    }

    @GetMapping("/getUserHys")
    public User getUserHys(){
        return userService.getUserHys();
    }
}
